//
//  UIButton+Extension.swift
//  LKweibo
//
//  Created by mac on 16/4/4.
//  Copyright © 2016年 什么人玩什么鸟. All rights reserved.
//

import UIKit

extension UIButton{
    
    convenience init(bgImgName: String, ImgName: String){
        
        //初始化一个按钮
        self.init()
        
        setImage(UIImage(named: ImgName), forState: .Normal)
        setImage(UIImage(named: "\(ImgName)_highlighted"), forState: UIControlState.Highlighted)
        
        setBackgroundImage(UIImage(named: bgImgName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(bgImgName)_highlighted"), forState: UIControlState.Highlighted)
        sizeToFit()
    }
}

extension UIButton{
    
    convenience init(bgImgName: String, titleName: String){
        
        //初始化一个按钮
        self.init()
        
        setTitle(titleName, forState: .Normal)
        setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal)
        
        setBackgroundImage(UIImage(named: bgImgName), forState: UIControlState.Normal)
        sizeToFit()
    }
}
